home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
8614
/
8614.xpi
/
modules
/
utils
/
PrivateBrowsing.jsm
< prev
next >
Wrap
Text File
|
2010-02-10
|
2KB
|
42 lines
// DO NOT import this into the global namespace, but instead
// import it into your own namespace wrapper
var EXPORTED_SYMBOLS = ["PrivateBrowsingListener"];
Components.utils.import("resource://glydo/utils/prototype_xul_1_6_0_3_modified.jsm");
Components.utils.import("resource://glydo/utils/Utils.jsm");
Components.utils.import("resource://glydo/utils/Events.jsm");
var PrivateBrowsingListener = Prototype.Class.create(EventSource,{
initialize : function ($super) {
$super();
this.os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
this.inPrivateBrowsing = false;
this.os.addObserver(this, "private-browsing", false);
this.os.addObserver(this, "quit-application", false);
try {
var pbs = Components.classes["@mozilla.org/privatebrowsing;1"].getService(Components.interfaces.nsIPrivateBrowsingService);
this.inPrivateBrowsing = pbs.privateBrowsingEnabled;
} catch(ex) {
// ignore exceptions in older versions of Firefox
}
},
observe : function (aSubject, aTopic, aData) {
if (aTopic == "private-browsing") {
if (aData == "enter") {
this.inPrivateBrowsing = true;
this.fire('onEnterPrivateBrowsing');
} else if (aData == "exit") {
this.inPrivateBrowsing = false;
this.fire('onExitPrivateBrowsing');
}
} else if (aTopic == "quit-application") {
this.os.removeObserver(this, "quit-application");
this.os.removeObserver(this, "private-browsing");
}
},
});